# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
import os


class Config(object):
    """配置参数"""
    def __init__(self, dataset):
        self.model_name = 'TextRCNN'
        self.train_path = dataset + '/data/train.txt'
        self.dev_path = dataset + '/data/dev.txt'
        self.test_path = dataset + '/data/test.txt'
        self.class_list = [x.strip() for x in open(
            dataset + '/data/class.txt', encoding='utf-8').readlines()]
        self.vocab_path = dataset + '/data/vocab.pkl'
        self.cb_path = dataset + '/checkpoints'
        self.model_path = os.path.join(dataset, 'textrcnn.ckpt')
        # 运行环境：Ascend, GPU, CPU
        self.device = 'GPU'

        # 深度学习的参数
        self.num_classes = len(self.class_list)
        self.n_vocab = 0
        self.num_epochs = 60
        self.batch_size = 128
        self.pad_size = 128
        self.learning_rate = 0.001
        self.embedding_size = 50
        self.hidden_size = 100
        self.num_layers = 1
